package org.ourgrid.broker.controlws.gatewayws.dao;

import java.util.HashMap;
import java.util.Map;

public class Broker3GDAO {

	private final Map<Long, JobSpec3G> mark2Job = new HashMap<Long, JobSpec3G>();
	
	public void putJob(long mark, JobSpec3G jobSpec) {
		mark2Job.put(mark, jobSpec);
	}

	public JobSpec3G getJob(long mark) {
		return mark2Job.get(mark);
	}
	
	public JobSpec3G removeJob(long mark) {
		return mark2Job.remove(mark);
	}
	
	public boolean isJobValid(long mark, int jobID) {
		JobSpec3G job = getJob(mark);
		return job != null && job.getJobID() == jobID;
	}
}
